<%--
  Created by IntelliJ IDEA.
  User: song
  Date: 2024-09-30
  Time: 19:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <title>Title</title>
  <link rel="stylesheet" href="/static/layui/css/layui.css">
  <style>


  </style>
</head>
<body>
<p>
  <form action="/student/list/1" method="post">
    <div class="layui-form-item">
      <div class="layui-input-inline layui-input-wrap">
        <input type="text" name="num" value="${student.num}" placeholder="请输入学号" lay-verify="required" autocomplete="off" lay-affix="clear" class="layui-input">
      </div>
      <div class="layui-input-inline layui-input-wrap">
        <input type="text" name="name" value="${student.name}" placeholder="请输入姓名" lay-verify="required" autocomplete="off" lay-affix="clear" class="layui-input">
      </div>
      <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">查询</button>
      <a class="layui-btn" href="/student/toadd" >新增学生</a>
    </div>
  </form>
</p>

<table class="layui-table" lay-even>
  <colgroup>
    <col width="150">
    <col width="150">
    <col>
    <col>
  </colgroup>
  <thead>
  <tr>
    <th>编号</th>
    <th>学号</th>
    <th>姓名</th>
    <th>性别</th>
    <th>年龄</th>
    <th>出生日期</th>
    <th>班级</th>
    <th>宿舍</th>
    <th>操作</th>
  </tr>
  </thead>
  <tbody>
  <c:forEach items="${students}" var="student">
    <tr>
      <td>${student.id}</td>
      <td>${student.num}</td>
      <td>${student.name}</td>
       <td>
         <!-- 根据性别的值显示男或女 -->
         <c:choose>
           <c:when test="${student.sex eq 0}">
             男
           </c:when>
           <c:when test="${student.sex eq 1}">
             女
           </c:when>
           <c:otherwise>
             保密
           </c:otherwise>
         </c:choose>
       </td>
      <td>${student.age}</td>
       <td>${student.birthday}</td>
      <td>${student.clazz}</td>
      <td>${student.dormitory}</td>
      <td>
        <a href="/student/toupdate/${student.id}">修改</a>
        <a href="/student/delete/${student.id}">删除</a>
      </td>
    </tr>
  </c:forEach>
  <tr>
    <td colspan="4" align="center">
      <a href="/student/list/1">首页</a>
      <c:if test="${page.currentPage!=1}">
      <a href="/student/list/${page.currentPage-1}">上一页</a>
      </c:if>
      第${page.currentPage}/${page.totalPage}页
      <c:if test="${page.currentPage!=page.totalPage}">
      <a href="/student/list/${page.currentPage+1}">下一页</a>
      </c:if>
      <a href="/student/list/${page.totalPage}">尾页</a>
    </td>
  </tr>
  </tbody>
</table>

</body>
</html>
